<?php
class Modulemanager_Model_Updatemodule implements Modulemanager_Model_Mainable{
    
    private $core_controller_notnull;
    private $core_controller_csrftoken;
    private $action_handler;
    
    private $excepted_result;
    
    private $modulemanager_data_modulesettingsupdate;
    private $module_settingsupdate_result;
    private $modulemanager_data_modulecontentvaluesupdate;
    private $module_contentvaluesupdate_result;
    private $modulemanager_data_modulemetavaluesupdate;
    private $module_metavaluesupdate_result;
    
    public function __construct() {
        $this->modulemanager_data_modulesettingsupdate = new Modulemanager_Data_Updatemodulesettings;
        $this->modulemanager_data_modulemetavaluesupdate = new Modulemanager_Data_Updatemodulemetavalues;
        $this->modulemanager_data_modulecontentvaluesupdate = new Modulemanager_Data_Updatemodulecontentvalues;
    }

    public function main(array $variables = null) {
        $this->core_controller_notnull = new Core_Controller_Notnull;
        $this->core_controller_notnull->main($variables);
        $this->core_controller_csrftoken = new Core_Controller_Csrftoken;
        $this->core_controller_csrftoken->main($variables);
        $this->module_settingsupdate_result = $this->modulemanager_data_modulesettingsupdate->main($variables);
        $this->module_metavaluesupdate_result = $this->modulemanager_data_modulemetavaluesupdate->main($variables);
        $this->module_contentvaluesupdate_result = $this->modulemanager_data_modulecontentvaluesupdate->main($variables);
        //var_dump($variables);
        //die();
        if(
                ($this->module_settingsupdate_result == $this->excepted_result) &&
                ($this->module_metavaluesupdate_result == $this->excepted_result) &&
                ($this->module_contentvaluesupdate_result == $this->excepted_result)
                ){
            $this->action_handler = new Modulemanager_Data_Modulemanagerredirect;
            return $this->action_handler->main($variables);
        }
        else {
            $this->action_handler = new Modulemanager_Data_Moduleerrormessage;
            return $this->action_handler->main($variables);
        }
    }

}
